<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<isperp:grid
	url="project/member/projectMemberList?projectId=${projectId }"
	showSearchbar="false" gridId="projectMemberGrid" pager="false"
	showPager="false" gridTitle="${pageTitle}" cusFormatterActions="true"
	cusDialogSize="normal" cusEditUrl="project/member/edit"
	ondbClickRowEvent="projectMemberGrid.edit(rowid);"
	cusDeleteUrl="project/member/delete">
	<jsp:attribute name="toolbar">
	<isperp:toolbar id="projectMemberGridToolbar">
		<isperp:button id="projectMemberGridCreate" icon="icon-plus"
				text="新增项目人员" onclick="addPerson()"></isperp:button>
	</isperp:toolbar>
	</jsp:attribute>
	<jsp:body>
		<isperp:column name="id" title="id" hidden="true"></isperp:column>
		<isperp:column name="member_name" title="姓名" width="100">
		</isperp:column>
		<isperp:column name="position_name" title="职位" width="120">
		</isperp:column>
		<isperp:column name="plan_in_date" title="计划进场时间" width="120">
		</isperp:column>
		<isperp:column name="plan_out_date" title="计划退场时间" width="120">
		</isperp:column>
	</jsp:body>
</isperp:grid>
<div style="display:none">
	<input id="selectSetPerson_input">
	<isperp:departmentUser displayValue="" ifIncludeNoRoleUser="false" 
		afterSelected="afterSelect_selectSetPerson(row);" multiselect="true"
		displayValueStyle="width:249px;" displayValueCssClass="required"
		idFieldName="name" valueControlId="selectSetPerson_input"
		id="selectSetPerson" name="selectSetPerson"></isperp:departmentUser>
</div>
<script type="text/javascript">
	function addPerson() {
		$('#selectSetPerson').click();
		return false;
	}
	function afterSelect_selectSetPerson(row) {
		var names = row[0];
		var projectId = '${model.id }'||$("#id").val();
		$.ajax({
			url : 'project/member/saveProjectMember',
			data : {
				projectId : projectId,
				userName : names
			},
			success : function(data) {
				projectMemberGrid.search();
			}
		});
	}
</script>
